use of arrays and for loops in c